#!/bin/bash

current_dir=$(dirname ${0})
soft_dir=/opt/softs
[ -d ${soft_dir} ] || mkdir -p ${soft_dir}

# install nginx
bash ../00_nginx/install.sh
# install node: 12.0.0 不要装太高的
bash ../19_node/install.sh

cd ${soft_dir}
#git clone git://github.com/mobz/elasticsearch-head.git
git clone https://github.com/mobz/elasticsearch-head.git || exit 1
cd elasticsearch-head
npm install || exit 1
npm run start &

cp ${current_dir}/elasticsearch-head.conf /etc/nginx/conf.d/

nginx -t && nginx -s reload

